package com.eshore.ezone;

import com.eshore.ezone.model.AppInfo;

import android.app.Application;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class EstoreApplication extends Application {
    private List<AppInfo> mAppInfoList;

    @Override
    public void onCreate() {
        super.onCreate();
        initAppInfoList();
    }
    
    private void initAppInfoList() {
        //read more than write 
        mAppInfoList = new CopyOnWriteArrayList<AppInfo>();
    }
    
    private void clearAppInfoList() {
        if(mAppInfoList != null) {
            mAppInfoList.clear();
            mAppInfoList = null;
        }
    }

    public List<AppInfo> getAppInfoList() {
        return mAppInfoList;
    }

    public void setAppInfoList(List<AppInfo> appInfoList) {
        this.mAppInfoList = appInfoList;
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        clearAppInfoList();
    }
}
